package com.threadlocaldemo.util;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class Requestutil {
    private static ThreadLocal<HttpServletRequest> request = new ThreadLocal<>();
    private static ThreadLocal<HttpServletResponse> response = new ThreadLocal<>();

    public static void setContext(HttpServletRequest req,HttpServletResponse res){
        Requestutil.request.set(req);
        Requestutil.response.set(res);
    }

    public static HttpServletRequest getRequest(){
        return request.get();
    }

    public static HttpServletResponse getResponse(){
        return response.get();
    }

}
